package com.sg.business.commons.labelprovider.organization;

import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;

import com.sg.business.model.etl.IndicatorData;

public class IndicatorLabelProvider extends LabelProvider implements
		ITableLabelProvider {

	@Override
	public Image getColumnImage(Object element, int columnIndex) {
		return null;
	}

	@Override
	public String getColumnText(Object element, int columnIndex) {
		IndicatorData indicatorWithOrg = (IndicatorData) element;
		if (columnIndex == 0) {
			return indicatorWithOrg.getOrgname();
		} else if (columnIndex == 1) {
			double prjdelay = indicatorWithOrg.getPrjdelay();
			if (prjdelay < 0) {
				return "N/A";
			}
			return prjdelay + "%";
		} else if (columnIndex == 2) {
			double operate = indicatorWithOrg.getOperate();
			if (operate < 0) {
				return "N/A";
			}
			return operate + "%";
		} else if (columnIndex == 3) {
			double prjchange = indicatorWithOrg.getPrjchange();
			if (prjchange < 0) {
				return "N/A";
			}
			return prjchange + "%";
		} else if (columnIndex == 4) {
			double prjover = indicatorWithOrg.getPrjover();
			if (prjover < 0) {
				return "N/A";
			}
			return prjover + "%";
		} else if (columnIndex == 5) {
			double prjbudgetaccuracy = indicatorWithOrg.getPrjbudgetaccuracy();
			if (prjbudgetaccuracy < 0) {
				return "N/A";
			}
			return prjbudgetaccuracy + "%";
		} else if (columnIndex == 6) {
			double taskdelay = indicatorWithOrg.getTaskdelay();
			if (taskdelay < 0) {
				return "N/A";
			}
			return taskdelay + "%";
		} else if (columnIndex == 7) {
			double workfull = indicatorWithOrg.getWorkfull();
			if (workfull < 0) {
				return "N/A";
			}
			return workfull + "%";
		}
		return null;
	}

}
